<?
include_once "accesscontrol.php";
?>

<script src="prototype.js"></script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function findSub(){
new Ajax.Request('findstate.php', {
	method: 'get',
	parameters:{						 
						 id: $F('country')
						},
	onLoading: function() { $('sub').update('Loading...') },
	onSuccess: function(transport){
						 if(transport.responseText){
						 	$('sub').update(transport.responseText);
						}
					}
				});
}
//-->
</SCRIPT>

<?

$q1 = "select * from job_seeker_info where uname = \"$_SESSION[uname]\" ";
$r1 = mysql_query($q1) or die(mysql_error());
$a1 = mysql_fetch_array($r1);

if(empty($a1[rTitle]))
{
	echo "<br><br><br><span class=TNA><center>You do not have resume!<br>Click <a href=\"build_resume.php\" class=BlackLink>here</a> to create your online resume now!</span>";
	include_once('../footer.php');
	exit();
}

?>


<SCRIPT LANGUAGE="JavaScript">

function checkFields() {
missinginfo = "";
if (document.form.rTitle.value == "") {
missinginfo += "\n     -  Resume title";
document.form.rTitle.focus();
}

if (document.form.NewEmail.value == "") {
missinginfo += "\n     -  Your email address";
document.form.NewEmail.focus();
}

if (document.form.NewAddress.value == "") {
missinginfo += "\n     -  Your address";
document.form.NewAddress.focus();
}

if (document.form.NewPhone.value == "") {
missinginfo += "\n     -  Your new phone";
document.form.NewPhone.focus();
}

if (document.form.NewCity.value == "") {
missinginfo += "\n     -  Your City";
document.form.NewCity.focus();
}

if (document.form.NewZip.value == "") {
missinginfo += "\n     -  Zip code";
document.form.NewZip.focus();
}

if (missinginfo != "") {
missinginfo ="_____________________________\n" +
"You failed to correctly fill in:\n" +
missinginfo + "\n_____________________________" +
"\nPlease re-enter and submit again!";
alert(missinginfo);
return false;
}
else return true;
}

</script>

<span class=HeaderClass>Edit Resume</span><br><br><br><br>

<form action=ER2.php method=post name=form onSubmit="return checkFields();" enctype="multipart/form-data">
<table align=center class=BlackText>
<tr>
	<td align=left>
		<img src="../re_images/<?=$a1[image]?>" width="150" height="200">
		<input type="hidden" id="img" name="img" value="<?=$a1[image]?>" /><br><br>
		<a href=delete_image.php?file=<?=$a1[image]?>>delete</a>
	</td>
</tr>

<tr>
<td align=left>
	<b>
	<label for="images">Change Photo:</label></b>
		<input type=file name="images" id="images"><br><br>
</tr>

<tr>
	<td align=left>
	<b>Title </b><br>
	(choose a title for your resume)<br>
	<input type=text name=rTitle size=45 value="<?=$a1[rTitle]?>">
	</td>
</tr>

<tr>
	<td align=left>
	<b>Introduce yourself to the employers</b>
	<br>
	(a short paragraph about you)<br>
	<textarea cols=42 rows=6 name=rPar><?=$a1[rPar]?></textarea>
	</td>
</tr>

<tr>
	<td>
	<table align=left width=350 class=BlackText>
	<tr>
		<td align=left>Email: </td>
		<td><input type=text name=NewEmail value="<?=$a1[job_seeker_email]?>"></td>
	</tr>
	
	<tr>
		<td align=left>Address: </td>
		<td><input type=text name=NewAddress value="<?=$a1[address]?>"></td>
	</tr>

	<tr>
		<td align=left>Street: </td>
		<td><input type=text name=NewStreet value="<?=$a1[street]?>"></td>
	</tr>

	<tr>
		<td align=left>City: </td>
		<td><input type=text name=NewCity value="<?=$a1[city]?>"></td>
	</tr>

	<tr>
		<td align=left>Zip: </td>
		<td><input size=10 type=text name=NewZip value="<?=$a1[zip]?>"></td>
	</tr>
	
<tr>
	<td align=left valign="top">State/Province: </td>
	<td>
<?php 
if($a1[country] == 'USA'){
?>
		<div id="sub">
			<select name=state>
				<option value=" ">Select</option>
<?php
foreach ($state as $key => $value){
if ($value == $a1[state]){
?>
		<option value="<?=$value?>" selected><?=$value?></option>
<?
}
else{
?>
	 <option value="<?=$value?>"><?=$value?></option>
<?
}
}
?>	
			</select>
		</div>
<?} else {?>
		<div id="sub">
		<input size=10 type=text name=state value="<?=$a1[state]?>">
		</div>
<? } ?>		
		</td>	
</tr>

<tr>
	<td align=left>Country: </td>
	<td><?=select_country1($a1[country], "country");?></td>	
</tr>

	<tr>
		<td align=left>Phone: </td>
		<td><input type=text name=NewPhone value="<?=$a1[phone]?>"></td>
	</tr>

	<tr>
		<td align=left>Mobile: </td>
		<td><input type=text name=NewPhone2 value="<?=$a1[phone2]?>"></td>
	</tr>

	<tr>
		<td align=left>Fax: </td>
		<td><input type=text name=NewFax value="<?=$a1[fax]?>"></td>
	</tr>

	</table>
	</td>
</tr>

<tr>
	<td align=left>
	  <input type=submit name=submit value="Save changes">
	<b> OR </b>
	<input type=submit name=submit value="Go to Step 1 (Work experience)">
	</td>
</tr>
</table>
</form>



<? include_once('../footer.php'); ?>